package cn.xiangxiang.service;

import cn.xiangxiang.service.goods.CategoryService;
import cn.xiangxiang.service.goods.SkuService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class InitData implements InitializingBean {

    @Autowired
    private CategoryService categoryService;

    @Autowired
    private SkuService skuService;

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("run................................");
        // 缓存分类
        categoryService.saveToRedis();
//        缓存价格
        skuService.saveToRedis();
    }
}
